<?php extract($events); ?>
<div id="content">
    <h2>My Events</h2>
    <div class="searchForm">
        <?=form_open('/faculty/event_search');?>
        <?=form_input('searchTerm');?>
        <?=form_submit('', 'Search');?>
        <?=form_close();?>
    </div>

    <table class="events">
        <tr><th colspan="5">Upcoming Events</th></tr>
        <tr><th>Event Name</th><th>Group Name</th><th>Location</th><th>Event Date</th><th>Time</th></tr>
        <?php if (isset($events['upcoming'])): ?>
            <?php foreach ($events['upcoming'] as $index => $event): ?>
            <tr>
                <td><a href="/faculty/event_details/<?=$event['event_id'];?>"><?=ucwords($event['event_name']);?></a></td>
                <td><a href="/faculty/group_details/group/<?=$event['group_id'];?>"><?=ucwords($event['group_name']);?></a></td>
                <td><?=$event['location_name'];?></td>
                <td><?=$event['start_date'];?></td>
                <td><?=$event['start_time'] . ' - ' . $event['end_time'];?></td>
            </tr><?php endforeach; ?>
        <?php endif; ?>
<tr><td class="divider" colspan="5">&nbsp;</td></tr>
        <tr><th colspan="5">Past Events</th></tr>
        <?php if (isset($events['past'])): ?>
            <?php foreach ($events['past'] as $index => $event): ?>
            <tr>
                <td><a href="/faculty/event_details/<?=$event['event_id'];?>"><?=ucwords($event['event_name']);?></a></td>
                <td><a href="/faculty/group_details/group/<?=$event['group_id'];?>"><?=ucwords($event['group_name']);?></a></td>
                <td><?=$event['location_name'];?></td>
                <td><?=$event['start_date'];?></td>
                <td><?=$event['start_time'] . ' - ' . $event['end_time'];?></td>
            </tr><?php endforeach; ?>
        <?php endif; ?>
    </table>
</div> <!-- #content -->